<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="myassets">
    <meta name="author" content="wangnima">
    <title>我的资产</title>
    <link href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <script src="http://cdn.bootcss.com/angular.js/1.4.0/angular.js"></script>
    <script src="js/controllers.js"></script>
    <link href="../css/style.css" rel="stylesheet">

    <script type="application/javascript">
        $(function() {
//            $("#navul li").click(function(){
//                $("#navul li").attr("class","");
//                $(this).attr("class","active");
//            });
        });

        function callback(data){
            if(data.ok==true){

            }
        }

        function studentController($scope) {
            $scope.student = {
                firstName: "Mahesh",
                lastName: "Parashar",
                fees:500,
                subjects:[
                    {name:'Physics',marks:70},
                    {name:'Chemistry',marks:80},
                    {name:'Math',marks:65},
                    {name:'English',marks:75},
                    {name:'Hindi',marks:67}
                ],
                fullName: function() {
                    var studentObject;
                    studentObject = $scope.student;
                    return studentObject.firstName + " " + studentObject.lastName;
                }
            };
        }
    </script>
</head>
<body role="document" ng-app="assetapp" ng-controller="assetctrl">
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav" id="navul">
                <li  ng-class="setCurrentTabClass('week')" ng-click="loaddata(7)"><a href="#">一周数据</a></li>
                <li  ng-class="setCurrentTabClass('month')"  ng-click="loaddata(30)"  ><a href="#">一月数据</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="container theme-showcase" role="main" >
    <div class="jumbotron">
        <h1>美股账户资产列表</h1>
    </div>
    <div class="row" ng-repeat="asset in assetdatas">
        <div class="col-md-6"  style="width: 40%">
            <table class="table">
                <thead>
                <tr>
                    <th width="120px">日期</th>
                    <th width="120px">资产总额</th>
                    <th width="120px">现金总额</th>
                    <th width="120px">比昨日增长</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>{{asset.thedate | date:'yyyy-MM-dd'}}</td>
                    <td>{{asset.assets/100 | currency:"$"}}</td>
                    <td>{{asset.cash/100  | currency:"$"}}</td>
                    <td><span ng-class="getRateClass(asset.toYestoday)">{{asset.toYestoday*100 | number : 2 }}%</span></td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="col-md-6" style="width: 60%">
            <table class="table" >
                <thead>
                <tr>
                    <th width="200px">股票名称</th>
                    <th width="200px">交易所</th>
                    <th width="200px">股票数量</th>
                    <th width="200px">开盘价</th>
                    <th width="200px">收盘价</th>
                    <th width="200px">股票总值 </th>
                </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="sharesItem in asset.sharesItems track by $index">
                        <td><a href="{{sharesItem.sharesStock.shares.url}}" target="_blank">{{sharesItem.sharesStock.shares.name}}</a></td>
                        <td>{{sharesItem.sharesStock.shares.organization}}</td>
                        <td>{{sharesItem.sharesStock.num}}</td>
                        <td>{{sharesItem.sharesPrice.open/100 | currency:"$"}}</td>
                        <td>{{sharesItem.sharesPrice.close/100 | currency:"$"}}</td>
                        <td>{{sharesItem.sharesStock.num * sharesItem.sharesPrice.close /100 | currency:"$"}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>